home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-09 | 2.8 KB | 56 lines | [TEXT/MPS ] |
-
- FinderDrag -
-
- CHANGES SINCE 1.0.
-
- The biggest change is that the code now uses the Apple Event Manager to pull
- the individual icons from the 'ifam' AEDesc returned by the Finder. The
- previous version actually walked the AEDesc handle and BlockMove'd the data
- into Handles. I know, this is bad and I feel just terrible about the whole
- thing… So this code now coerces the ifam into an AERecord and uses
- AEGetKeyPtr(..., iconType, iconType, ...) to obtain the data. I've noticed
- that I'm getting a much more restful sleep since making this change.
-
- Nitin Ganatra, 5/95
-
- --------------------------------------------------------------------------
-
- This actually demonstrates how to do a few different things involding
- the Drag Manager and Finder Events:
-
- 1. FinderDrag demonstrates one way to deal with performing certain tasks
- when a drag is received. It is not possible to do a few things from
- tracking/receive handlers (for example, call WaitNextEvent when a minor
- switch could take place, or call AESend and wait for a reply). Another
- annoyance is that you cannot debug tracking/receive handlers from a
- source level one machine debugger. This application demonstrates how to
- package up the contents of a receive and send it back to the application
- via an AppleEvent. Note that if you need to do things like call a
- routine that gives up control to other processes, you must always
- send the event to yourself through your main event loop. If you're
- using this method just to allow you to debug a complex receive handler,
- you can send yourself the Apple Events through your main event loop while
- debugging, and once you're done you can use direct dispatch AppleEvents.
- For more information check out the SendToSelf Tech note (in Processes).
-
- 2. FinderDrag demonstrates how to check that the scriptable Finder is
- present, and how to send Apple Events to it. In particular, this
- demonstrates how to get an icon family for a file system object.
- Unfortunately, there is no API for picking apart an 'ifam' AEDescriptor
- that's sent back to you, so you need to do it by hand (as done in this
- sample).
-
- 3. It demonstrates how to keep a reference to an existing HFS object, and
- how to move it around in the Finder's heirarchy using Finder Events. This
- code is a bit ugly because of some bugs in the Finder, but this is the
- best way to do it for now. Hopefully a future version of the Finder will
- allow you to simply drag hfsFlavor objects from one folder to another..
- For now you need to create a promise HFS flavor, and when the send data proc
- is called, create a dummy file in the directory specified by the Finder.
- Then after the call to TrackDrag completes and if the drag was successful,
- delete the dummy file and move the file(s) specified by hand to their
- new location.
-
- This sample compiles under MetroWerks and MPW.
-
- by Nitin Ganatra, 3/95